package com.kjzy.controller;

import com.kjzy.pojo.Devices;
import com.kjzy.pojo.Person;
import com.kjzy.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PersonController {
    @Autowired
    private PersonService personService;
    @RequestMapping(value = "/user_son")
    public String PersonManage(@RequestParam("id")Integer id, Model model) {
        Person person= personService.findByid(id);

        model.addAttribute("person", person);

        // 1. 返回待跳转的逻辑视图名。本例中，将跳转
        // 到"/WEB-INF/jsp/admin/user_manage.jsp"。
        return "admin/user_home";
    }
    @RequestMapping("/updatePerson.action")
    @ResponseBody
    public String updatePerson(@RequestBody Person person){
        String result=personService.updatePerson(person);
        return result;
    }
}
